{% extends "base_blank.volt" %}

{% block pageFooter%}
    <script type="text/javascript">
        var activityId = {{ id }};
    </script>
    {{ javascript_include("/js/area.js", false) }}
    {{ javascript_include("/assets/manage/js/activity/bpAdd.js", false) }}
{% endblock %}

{% block content %}
    <div class="container-fluid" id="content_box_blank">
        <div class="row">
            <div class="col-xs-12">
                <ol class="breadcrumb">
                    <li>活动管理</li>
                    <li class="active">设置美容院参加活动</li>
                    <li class="active pull-right"><a href="{{ url.get('activity/bpList', ['id': id]) }}" class="btn btn-primary btn-xs"><i class="fa fa-chevron-left"></i> 返回已参加列表</a></li>
                </ol>

                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-inline" role="form" action="" method="get">
                            <div class="form-group">
                                <div class="input-group">
                                    <label class="input-group-addon" for="filterName">店铺名称:</label>
                                    <input class="form-control" type="text" name="filterName" id="filterName" value="{{ filterName|escape_attr }}" />
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="input-group">
                                    <label class="input-group-addon">省</label>
                                    <select class="form-control" name="filterProvince" id="filterProvince" dvalue="{{ filterProvince|escape_attr }}">
                                        <option value="">全部</option>
                                    </select>
                                    <label class="input-group-addon">市</label>
                                    <select class="form-control" name="filterCity" id="filterCity" dvalue="{{ filterCity|escape_attr }}">
                                        <option value="">全部</option>
                                    </select>
                                    <label class="input-group-addon">区/县</label>
                                    <select class="form-control" name="filterDistrict" id="filterDistrict" dvalue="{{ filterDistrict }}">
                                        <option value="-10000">全部</option>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <button type="submit" class="btn btn-primary"><i class="fa fa-filter"></i> 搜 索</button>
                            </div>
                        </form>
                    </div>
                </div>

                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th style="width: 60px;">ID</th>
                        <th style="width: 100px;">封面</th>
                        <th>名称</th>
                        <th style="width: 150px;">城区</th>
                        <th style="width: 60px;">是否<br />销售</th>
                        <th style="width: 60px;">退款<br />保障</th>
                        <th style="width: 60px;">深度<br />验店</th>
                        <th style="width: 180px;"></th>
                    </tr>
                    </thead>
                    {% for d in data %}
                        <tr>
                            <td>{{ d['bp_id'] }}</td>
                            <td><img src="{{ PicUrlBPCover(d['bp_cover'], this.di) }}@!90" /></td>
                            <td>{{ d['bp_name']|e }}</td>
                            <td>{{ d['district'] }}</td>
                            <td>{{ d['bp_is_sell'] == 1 ? 'Y' : 'N' }}</td>
                            <td>{{ BPMedalRefund(d['bp_medal']) == 1 ? 'Y' : 'N' }}</td>
                            <td>{{ BPMedalVerify(d['bp_medal']) == 1 ? 'Y' : 'N' }}</td>
                            <td>
                                {% if d['bp_state'] == 1 %}
                                    <button type="button" class="btn btn-default btn-sm" disabled="disabled">已添加</button>
                                {% endif %}
                                {% if d['bp_state'] != 1 %}
                                    <button type="button" class="btn btn-primary btn-sm but_bp_join" did="{{ d['bp_id'] }}" durl="{{ url.get('activity/bpJoin') }}"><i class="fa fa-puzzle-piece fa-fw"></i> 添 加</button>
                                {% endif %}
                                <a href="/frontend/share/beautyParlor?id={{ d['bp_id'] }}" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-eye fa-fw"></i> 预 览</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>

                {{ this.tagNav.page(
                    page,
                    total,
                    limit,
                    url.get('activity/addBp', [
                        'id': id,
                        'filterName': filterName,
                        'filterProvince': filterProvince,
                        'filterCity': filterCity,
                        'filterDistrict': filterDistrict,
                        'page': '__PAGE__'
                    ]
                )) }}

            </div>
        </div>
    </div>
{% endblock %}